import './assets/main.css'

import { createApp } from 'vue'
import { createPinia } from 'pinia'

import App from './App.vue'
import router from './router'
import echarts from './plugins/echarts'
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import axios from 'axios'

const app = createApp(App)

app.use(createPinia())
app.use(router)
app.use(ElementPlus)
app.use(echarts)

// axios错误拦截
axios.interceptors.response.use(
  (response) => response,
  (error) => {
    console.error('API请求失败:', error)
    return Promise.reject(error)
  },
)

// Vue错误处理
app.config.errorHandler = (err) => {
  console.error('全局捕获的Vue错误:', err)
}

app.mount('#app')
